package com.sg.hms.Model;
/***
 * 分页模型
 * @author 吴磊
 *
 */
public class Pagebean {
	private  int page;//当前页面
	private  int pageSize;//页面尺寸
	private  int start;//其实位子
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getStart() {
		return (page-1)*pageSize;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public Pagebean(int page, int pageSize) {
		super();
		this.page = page;
		this.pageSize = pageSize;
	}
	/**
	 *  设置分页
	 * @param totalNum  获取数据总数
	 * @param currentPage  获取当前页面
	 * @param pageSize  页面容量
	 * @return
	 */
	public  String  getthisPage(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='allroom?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='allroom?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='allroom?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='disabled'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='allroom?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='allroom?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
	public  String  getthisPage1(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='searchkey?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='searchkey?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='searchkey?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='searchkey'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='searchkey?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='searchkey?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
	public  String  getthisPage3(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='allapplication?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='allapplication?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='allapplication?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='disabled'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='allapplication?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='allapplication?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
	public  String  getthisPage2(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='allapplication?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='allapplication?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='allapplication?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='disabled'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='allapplication?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='allapplication?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
	public  String  getthisPage4(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='someapp?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='someapp?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='someapp?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='disabled'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='someapp?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='someapp?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
	public  String  getthisPage5(int totalNum,int currentPage,int pageSize){
		int totalPage = totalNum%pageSize==0?totalNum/pageSize:totalNum/pageSize+1;
		StringBuffer page =  new StringBuffer();
		page.append("<li><a href='searchapplication?page=1'>首页</a></li>");
		if(currentPage==1){
			page.append("<li class='disabled'><a href='#'>上一页</a></li>");
		}else{
			page.append("<li><a href='searchapplication?page="+(currentPage-1)+"'>上一页</a></li>");
		}
		//���ҳ��     ��ǰҳ 2        0                  4
		for (int i = currentPage-2; i < currentPage+2; i++) {
				if(i<1||i>totalPage){
					continue;
				}
				if(i==currentPage){
					page.append("<li class='active'><a href='#'>"+i+"</a></li>");
				}else{
					page.append("<li><a href='searchapplication?page="+i+"'>"+i+"</a></li>");
				}
		}
		if(currentPage==totalPage){
			page.append("<li class='disabled'><a href='#'>下一页</a></li>");
		}else{
			page.append("<li><a href='searchapplication?page="+(currentPage+1)+"'>下一页</a></li>");
		}
	
		
		page.append("<li><a href='searchapplication?page="+totalPage+"'>尾页</a></li>");
		return  page.toString();
	}
}
